package com.fuershiye.woman.monitor.enums;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.HashMap;
import java.util.Map;

@Getter
@RequiredArgsConstructor
public enum CodeRelationEnum {

    A004("A004","A002","A003"),
    A031("A031","A007","A008"),
    A032("A032","A010","A011"),
    A033("A033","A013","A014"),
    A034("A034","A016","A017"),
    A035("A035","A019","A020"),
    A036("A036","A022","A023"),
    A037("A037","A025","A026"),
    A038("A038","A028","A029"),
    A042("A042","A040","A041"),
    A046("A046","A044","A045"),
    A051("A051","A049","A050"),
    A055("A055","A053","A054"),
    A059("A059","A057","A058"),
    A063("A063","A061","A062"),
    A067("A067","A065","A066"),
    A071("A071","A069","A070"),
    A075("A075","A073","A074"),
    A079("A079","A077","A078"),
    A083("A083","A081","A082"),
    A087("A087","A085","A086"),
    A091("A091","A089","A090"),
    A095("A095","A093","A094"),
    A099("A099","A097","A098"),
    A111("A111","A102","A103"),
    A112("A112","A105","A106"),
    A113("A113","A108","A109"),
    A118("A118","A116","A117"),
    A122("A122","A120","A121"),
    A126("A126","A124","A125"),
    A130("A130","A128","A129"),
    A134("A134","A132","A133"),
    A138("A138","A136","A137"),
    A142("A142","A140","A141"),
    A146("A146","A144","A145"),
    A150("A150","A148","A149"),
    A154("A154","A152","A153"),
    A158("A158","A156","A157"),
    A162("A162","A160","A161"),
    A166("A166","A164","A165"),
    A170("A170","A168","A169"),
    A174("A174","A172","A173"),
    A187("A187","A185","A186"),
    B004("B004","B002","B003"),
    B010("B010","B008","B009"),
    B024("B024","B022","B023"),
    B028("B028","B026","B027"),
    B034("B034","B032","B033"),
    C028("C028","C026","C027"),
    C032("C032","C030","C031"),
    C036("C036","C034","C035"),
    C040("C040","C038","C039"),
    C044("C044","C042","C043"),
    C048("C048","C046","C047"),
    C052("C052","C050","C051"),
    C056("C056","C054","C055"),
    C060("C060","C058","C059"),
    C064("C064","C062","C063"),
    C068("C068","C066","C067"),
    C072("C072","C070","C071"),
    C076("C076","C074","C075"),
    C080("C080","C078","C079"),
    C084("C084","C082","C083"),
    C088("C088","C086","C087"),
    C092("C092","C090","C091"),
    C096("C096","C094","C095"),
    C100("C100","C098","C099"),
    C104("C104","C102","C103"),
    C108("C108","C106","C107"),
    C112("C112","C110","C111"),
    C116("C116","C114","C115"),
    C120("C120","C118","C119"),
    C124("C124","C122","C123"),
    C128("C128","C126","C127"),
    C132("C132","C130","C131"),
    C136("C136","C134","C135"),
    C140("C140","C138","C139"),
    C144("C144","C142","C143"),
    C148("C148","C146","C147"),
    C152("C152","C150","C151"),
    C156("C156","C154","C155"),
    C160("C160","C158","C159"),
    C164("C164","C162","C163"),
    C168("C168","C166","C167"),
    C172("C172","C170","C171"),
    C176("C176","C174","C175"),
    C180("C180","C178","C179"),
    C184("C184","C182","C183"),
    C188("C188","C186","C187"),
    C192("C192","C190","C191"),
    C196("C196","C194","C195"),
    C200("C200","C198","C199"),
    C204("C204","C202","C203"),
    C208("C208","C206","C207"),
    C212("C212","C210","C211"),
    C216("C216","C214","C215"),
    C220("C220","C218","C219"),
    C224("C224","C222","C223"),
    C228("C228","C226","C227"),
    C232("C232","C230","C231"),
    C236("C236","C234","C235"),
    C240("C240","C238","C239"),
    C244("C244","C242","C243"),
    C248("C248","C246","C247"),
    C252("C252","C250","C251"),
    C256("C256","C254","C255"),
    C260("C260","C258","C259"),
    C264("C264","C262","C263"),
    C268("C268","C266","C267"),
    C272("C272","C270","C271"),
    C276("C276","C274","C275"),
    C280("C280","C278","C279"),
    C284("C284","C282","C283"),
    C288("C288","C286","C287"),
    C292("C292","C290","C291"),
    C296("C296","C294","C295"),
    C300("C300","C298","C299"),
    C304("C304","C302","C303"),
    C308("C308","C306","C307"),
    C312("C312","C310","C311"),
    C316("C316","C314","C315"),
    C320("C320","C318","C319"),
    C324("C324","C322","C323"),
    C328("C328","C326","C327"),
    C332("C332","C330","C331"),
    C336("C336","C334","C335"),
    C340("C340","C338","C339"),
    C344("C344","C342","C343"),
    C348("C348","C346","C347"),
    C352("C352","C350","C351"),
    C356("C356","C354","C355"),
    C360("C360","C358","C359"),
    C364("C364","C362","C363"),
    C368("C368","C366","C367"),
    C375("C375","C373","C374"),
    C379("C379","C377","C378"),
    C383("C383","C381","C382"),
    C387("C387","C385","C386"),
    C391("C391","C389","C390"),
    C395("C395","C393","C394"),
    C399("C399","C397","C398"),
    D004("D004","D002","D003"),
    D008("D008","D006","D007"),
    D012("D012","D010","D011"),
    D016("D016","D014","D015"),
    D020("D020","D018","D019"),
    D024("D024","D022","D023"),
    D028("D028","D026","D027"),
    D032("D032","D030","D031"),
    D036("D036","D034","D035"),
    D040("D040","D038","D039"),
    D044("D044","D042","D043"),
    D048("D048","D046","D047"),
    D052("D052","D050","D051"),
    D056("D056","D054","D055"),
    D060("D060","D058","D059"),
    D064("D064","D062","D063"),
    D068("D068","D066","D067"),
    D072("D072","D070","D071"),
    D076("D076","D074","D075"),
    D080("D080","D078","D079"),
    D084("D084","D082","D083"),
    D088("D088","D086","D087"),
    D092("D092","D090","D091"),
    D096("D096","D094","D095"),
    D100("D100","D098","D099"),
    D104("D104","D102","D103"),
    D108("D108","D106","D107"),
    D112("D112","D110","D111"),
    D116("D116","D114","D115"),
    D120("D120","D118","D119"),
    D124("D124","D122","D123"),
    D128("D128","D126","D127"),
    D132("D132","D130","D131"),
    D136("D136","D134","D135"),
    D140("D140","D138","D139"),
    D144("D144","D142","D143"),
    D148("D148","D146","D147"),
    D152("D152","D150","D151"),
    D156("D156","D154","D155"),
    D160("D160","D158","D159"),
    D164("D164","D162","D163"),
    D168("D168","D166","D167"),
    D172("D172","D170","D171"),
    D176("D176","D174","D175"),
    D180("D180","D178","D179"),
    D184("D184","D182","D183"),
    D188("D188","D186","D187"),
    D192("D192","D190","D191"),
    D196("D196","D194","D195"),
    D200("D200","D198","D199"),
    D204("D204","D202","D203"),
    D208("D208","D206","D207"),
    D212("D212","D210","D211"),
    D216("D216","D214","D215"),
    D220("D220","D218","D219"),
    D224("D224","D222","D223"),
    E004("E004","E002","E003"),
    E008("E008","E006","E007"),
    E012("E012","E010","E011"),
    E016("E016","E014","E015"),
    E020("E020","E018","E019"),
    E027("E027","E025","E026"),
    E031("E031","E029","E030"),
    E035("E035","E033","E034"),
    E039("E039","E037","E038"),
    E044("E044","E042","E043"),
    E048("E048","E046","E047"),
    E052("E052","E050","E051"),
    F004("F004","F002","F003"),
    F008("F008","F006","F007"),
    F012("F012","F010","F011"),
    F016("F016","F014","F015"),
    F020("F020","F018","F019"),
    F024("F024","F022","F023"),
    F028("F028","F026","F027"),
    F032("F032","F030","F031"),
    F036("F036","F034","F035"),
    F040("F040","F038","F039"),
    F044("F044","F042","F043"),
    F048("F048","F046","F047"),
    F052("F052","F050","F051"),
    F056("F056","F054","F055"),
    F060("F060","F058","F059"),
    F064("F064","F062","F063"),
    F068("F068","F066","F067"),
    F072("F072","F070","F071"),
    F076("F076","F074","F075"),
    F080("F080","F078","F079"),
    F084("F084","F082","F083"),
    F088("F088","F086","F087"),
    F092("F092","F090","F091"),
    F096("F096","F094","F095"),
    F100("F100","F098","F099"),
    F104("F104","F102","F103"),
    F108("F108","F106","F107"),
    F112("F112","F110","F111"),
    F116("F116","F114","F115"),
    F120("F120","F118","F119"),
    F124("F124","F122","F123"),
    F128("F128","F126","F127"),
    G004("G004","G002","G003"),
    G008("G008","G006","G007"),
    G012("G012","G010","G011"),
    G016("G016","G014","G015"),
    G020("G020","G018","G019"),
    G024("G024","G022","G023"),
    G028("G028","G026","G027"),
    G032("G032","G030","G031"),
    G036("G036","G034","G035"),
    G040("G040","G038","G039"),
    G044("G044","G042","G043"),
    G048("G048","G046","G047"),
    G052("G052","G050","G051"),
    G056("G056","G054","G055"),
    G060("G060","G058","G059"),
    G064("G064","G062","G063"),
    G068("G068","G066","G067"),
    H007("H007","H005","H006"),
    H011("H011","H009","H010"),
    H039("H039","H037","H038"),
    H043("H043","H041","H042"),
    I004("I004","I002","I003"),
    I008("I008","I006","I007"),
    I012("I012","I010","I011"),
    I016("I016","I014","I015"),
    I020("I020","I018","I019"),
    I024("I024","I022","I023"),
    I028("I028","I026","I027"),
    I032("I032","I030","I031"),
    I036("I036","I034","I035"),
    I040("I040","I038","I039"),
    I044("I044","I042","I043"),
    I048("I048","I046","I047"),
    I052("I052","I050","I051"),
    I056("I056","I054","I055"),
    I060("I060","I058","I059"),
    I064("I064","I062","I063"),
    I068("I068","I066","I067"),
    I072("I072","I070","I071"),
    I076("I076","I074","I075"),
    I080("I080","I078","I079"),
    I084("I084","I082","I083"),
    I088("I088","I086","I087"),
    I092("I092","I090","I091"),
    I096("I096","I094","I095"),
    I100("I100","I098","I099"),
    I104("I104","I102","I103"),
    I108("I108","I106","I107"),
    I112("I112","I110","I111"),
    I116("I116","I114","I115"),
    I120("I120","I118","I119"),
    I124("I124","I122","I123"),
    I128("I128","I126","I127"),
    I132("I132","I130","I131"),
    I136("I136","I134","I135"),
    I140("I140","I138","I139"),
    I144("I144","I142","I143"),
    J007("J007","J005","J006"),
    J011("J011","J009","J010"),
    J015("J015","J013","J014"),
    J019("J019","J017","J018"),
    J023("J023","J021","J022"),
    J027("J027","J025","J026"),
    J031("J031","J029","J030"),
    J035("J035","J033","J034"),
    J039("J039","J037","J038"),
    J043("J043","J041","J042"),
    J047("J047","J045","J046"),
    J051("J051","J049","J050"),
    J055("J055","J053","J054"),
    J059("J059","J057","J058"),
    ;

    private final String code;
    private final String codeUp;
    private final String codeDown;

    private static final Map<String, CodeRelationEnum> INSTANCE_MAP = new HashMap<>();
    private static final Map<String, CodeRelationEnum> UP_MAP = new HashMap<>();
    private static final Map<String, CodeRelationEnum> DOWN_MAP = new HashMap<>();

    static {
        for (CodeRelationEnum codeRelation: CodeRelationEnum.values()) {
            INSTANCE_MAP.put(codeRelation.code, codeRelation);
            UP_MAP.put(codeRelation.codeUp, codeRelation);
            DOWN_MAP.put(codeRelation.codeDown, codeRelation);
        }
    }

    public static CodeRelationEnum getByCode(String code){
        return INSTANCE_MAP.get(code);
    }
    public static CodeRelationEnum getByCodeUp(String code){
        return UP_MAP.get(code);
    }
    public static CodeRelationEnum getByCodeDown(String code){
        return DOWN_MAP.get(code);
    }

}
